<template>
	<!-- 门店详情 -->
	<view>
		<!-- 轮播图 -->
		<view>
			<uni-swiper-dot :info="info" :current="current" field="content" :mode="mode">
				<swiper class="swiper-box" @change="change" autoplay="true" interval="3000">
					<swiper-item v-for="(item ,index) in info" :key="index">
						<view class="swiper-item">
							<img src="/static/CarMaintenance/beijing.jpg" style="width: 100%;" />
						</view>
					</swiper-item>
				</swiper>
			</uni-swiper-dot>
		</view>
		<!-- 文字介绍 -->
		<view class="text">
			<text>伟业汽车保养厂(人民路店)</text>
			<view class="score">
				<uni-rate class="xx" size="18" :readonly="true" :value="storeScore" />
				<text>{{storeScore}}分</text>
				<text>销量：332</text>
			</view>
			<text>营业时间：周一至周五 09:00-22:00</text><br />
			<text>郑州市人民路36号</text>
			<img src="/static/CarMaintenance/beijing.jpg" mode=""
				style="width: 14px; height: 14px; padding-left: 10px;" />
		</view>
		<!-- 服务 -->

		<view class="service">

			<text>服务</text>

			<view class="serviceClassify">

				<uni-data-checkbox multiple v-model="value" :localdata="range"></uni-data-checkbox>

			</view>

			<text style="padding-left: 15px;">¥ 199</text>

			<text style="padding-left: 25px; color: red; text-decoration: line-through;">¥ 299</text><br />

			<text>服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍服务介绍</text>

		</view>

		<!-- 服务评价 -->
		<view class="evaluate">
			<text>服务评价</text>
			<!-- 评价列表 -->
			<view class="evaluateList">
				<view>
					<image src="/static/CarMaintenance/beijing.jpg" mode="" class="avatar"></image>
				</view>
				<view class="userMsg">
					<text>李**</text>
					<text>2022-09-10</text>
					<view>
						<uni-rate class="xx" size="18" :readonly="true" :value="userScore" />
					</view>
					<view class="evaluateContent">
						评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容评价内容
					</view>
				</view>
			</view>
		</view>
		<view style="height: 50px;"></view>
		<view class="twoBtn">
			<button type="primary" @click="toggle('bottom')">购物车(0)</button>
			<button @click="ToWConfirmAnOrder">确认已选服务</button>
		</view>
		<!-- 弹窗 -->
		<view>
			<!-- 普通弹窗 -->
			<uni-popup ref="popup" background-color="#fff">
				<view class="popup-content" @change="change">
					<view class="orderText">
						<text>服务订单</text>
						<uni-icons type="closeempty" size="15" class="closePop" @click="close"></uni-icons>
					</view>
					<view class="uni-list">
						<checkbox-group @change="checkboxChange">
							<label class="uni-list-cell" v-for="item in items" :key="item.value">
								<view>
									<checkbox :value="item.value" :checked="item.checked" />
								</view>
								<view>{{item.name}}</view>
								<view class="checkPrice">
									{{item.price}}
								</view>
							</label>
						</checkbox-group>
					</view>
				</view>
				<view class="twoBtn2">
					<button type="primary" @click="toggle('bottom')">合计(597)</button>
					<button>确认</button>
				</view>
			</uni-popup>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				info: [{
					content: ''
				}, {
					content: ''
				}, {
					content: ''
				}, {
					content: ''
				}, {
					content: ''
				}, ],
				current: 0,
				mode: 'round',
				storeScore: 4, // 评分
				userScore: 3,
				value: 0,
				range: [{
					"value": 0,
					"text": "小保养套餐1（合成机油+机滤）"
				}],
				customButtonGroup1: [{
					text: '购物车',
					backgroundColor: '#ff0000',
					color: '#fff'
				}],
				items: [{
						value: '0',
						name: '日式水晶打蜡',
						price: '¥199'
					},
					{
						value: '1',
						name: '车身去氧化',
						price: '¥199'
					},
					{
						value: '2',
						name: '轮胎补气',
						price: '¥199'
					},
				]
			}
		},
		methods: {
			change(e) {
				this.current = e.detail.current;
			},
			toggle(type) {
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				console.log(type);
				this.$refs.popup.open(type)
			},
			close() {
				this.$refs.popup.close()
			},
			checkboxChange: function(e) {
				var items = this.items,
					values = e.detail.value;
				for (var i = 0, lenI = items.length; i < lenI; ++i) {
					const item = items[i]
					if (values.includes(item.value)) {
						this.$set(item, 'checked', true)
					} else {
						this.$set(item, 'checked', false)
					}
				}
			},
			// 测试跳转到订单详情
			ToWConfirmAnOrder(){
				uni.navigateTo({
					url:'/pages/CarMaintenance/WConfirmAnOrder/WConfirmAnOrder'
				})
			}
		}
	}
</script>



<style>
	page {
		background-color: #fff;
	}
	.swiper-box {
		height: 225px;
	}
	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 225px;
		color: #fff;
	}
	.text text:nth-child(1) {
		color: rgba(16, 16, 16, 1);
		font-size: 16px;
		font-weight: bold;
		position: relative;
	}
	.text text:nth-child(3) {
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
	}
	.text text:nth-child(5) {
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
	}
	.text {
		padding-left: 16px;
		padding-top: 17px;
		padding-bottom: 10px;
		border-bottom: 1px solid #F1F1F1;
	}
	.xx {
		margin: 10rpx 0;
	}
	.score {
		position: relative;
	}
	.score text {
		margin: 10rpx 0;
	}
	.score text:nth-child(2) {
		position: absolute;
		right: 450rpx;
		color: rgba(108, 108, 108, 1);
		font-size: 14px;
		top: -10rpx;
	}
	.score text:nth-child(3) {
		position: absolute;
		color: rgba(16, 16, 16, 1);
		font-size: 12px;
		right: 300rpx;
		top: -13rpx;
	}
	.service {
		padding-top: 10px;
		padding-left: 31px;
	}
	.service text:nth-child(1) {
		color: rgba(16, 16, 16, 1);
		font-size: 16px;
	}
	.evaluate {
		padding-left: 36px;
		padding-top: 25px;
	}
	.evaluate>text:nth-child(1) {
		font-size: 16px;
		font-weight: 1000;
	}
	.evaluateList {
		padding-top: 10px;
		display: flex;
		line-height: 16px;
	}
	.avatar {
		width: 40px;
		height: 40px;
		border-radius: 100%;
	}
	.userMsg {
		padding: 0 15px;
		font-size: 14px;
	}
	.userMsg text:nth-child(2) {
		position: absolute;
		right: 36px;
	}
	.evaluateContent {
		padding-top: 5px;
		padding-right: 10px;
	}
	.twoBtn {
		background-color: #fff;
		display: flex;
		position: fixed;
		bottom: 0px;
	}
	.twoBtn button {
		width: 160px;
		height: 40px;
		border-radius: 100px;
		font-size: 14px;
		text-align: center;
	}
	.twoBtn>button:nth-child(1) {
		background-color: rgba(19, 200, 255, 1.0);
		color: rgba(255, 255, 255, 1);
		margin-left: 18px;
	}
	.twoBtn>button:nth-child(2) {
		background-color: rgba(255, 64, 0, 1);
		color: rgba(255, 255, 255, 1);
		margin-left: 18px;
	}
	.twoBtn2 {
		display: flex;
		top: 20px;
		bottom: 2px;
	}
	.twoBtn2 button {
		width: 160px;
		height: 40px;
		border-radius: 100px;
		font-size: 14px;
		text-align: center;
	}
	.twoBtn2>button:nth-child(1) {
		background-color: rgba(19, 200, 255, 1.0);
		color: rgba(255, 255, 255, 1);
		margin-left: 18px;
	}
	.twoBtn2>button:nth-child(2) {
		background-color: rgba(255, 64, 0, 1);
		color: rgba(255, 255, 255, 1);
		margin-left: 18px;
	}
	.orderText {
		padding-left: 10px;
		background-color: #EFEFEF;
		height: 53px;
		line-height: 53px;
		font-size: 14px;
		border: 1px solid #D1D1D1;
	}
	.uni-list-cell {
		display: flex;
		justify-content: flex-start;
		margin: 0 20px;
		height: 40px;
		line-height: 40px;
		border-bottom: 1px solid #F1F1F1;
		font-size: 12px;
	}
	.checkPrice {
		position: absolute;
		right: 40px;
	}
	.closePop {
		position: absolute;
		right: 20px;
	}
</style>